#include "DoubleLinkedList.h"

// 双向链表测试
// 测试添加

void test1() {
    DList* list = init_list();
    add_head(list, 1);
    add_head(list, 2);
    add_head(list, 3);
    add_head(list, 4);
    add_head(list, 5);
    add_head(list, 6);
    add_head(list, 7);
    add_head(list, 8);
    add_head(list, 9);
    add_head(list, 10);
    print_DList_from_head(list);
    print_DList_from_tail(list);
    del_head(list);
    del_tail(list);
    del_node(list, 5);
    print_DList_from_head(list);
    printf("get_node: %d\n", get_node(list, 0));
    printf("get_node: %d\n", get_node(list, 4));
    printf("get_node: %d\n", get_node(list, 6));
    printf("get_head: %d\n", get_head(list));
    printf("get_tail: %d\n", get_tail(list));
    printf("get_length: %d\n", get_length(list));
    clear_DList(list);
}

int main() {
    void (*func[])() = {test1};
    int len = sizeof(func) / sizeof(*func);
    for (int i = 0; i < len; ++i) {
        func[i]();
    }
    return 0;
}